#ifndef GLSHADEROBJECT_H
#define GLSHADEROBJECT_H

#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>

class glShader;

class glShaderObject
{
    friend class glShader;
public:
    glShaderObject();
    virtual ~glShaderObject();
    int     load(char* filename);
    void    loadFromMemory(const char* program);

    bool    compile(void);
    char*   getCompilerLog(void);
    GLint   getAttribLocation(char* attribName);

protected:
    int         program_type;
    GLuint      ShaderObject;
    GLubyte*    ShaderSource;

    GLcharARB*  compiler_log;

    bool        is_compiled;            //true if compiled
    bool        _memalloc;              //true if memory for shader source was allocated
};

//-----------------------------------------------

class aVertexShader : public glShaderObject
{
public:
    aVertexShader();
    virtual ~aVertexShader();
};

//-----------------------------------------------

class aFragmentShader : public glShaderObject
{
public:
    aFragmentShader();
    virtual ~aFragmentShader();
};

//-----------------------------------------------

class aGeometryShader : public glShaderObject
{
public:
    aGeometryShader();
    virtual ~aGeometryShader();
};

#endif // GLSHADEROBJECT_H
